package medium;

import cn.hutool.core.util.RandomUtil;
import lombok.extern.slf4j.Slf4j;

/**
 * @Author: 582895699@qq.com
 * @Desctription: 销售
 * @Date: Created in 2021/12/17 14:10
 */
@Slf4j
public class Sale {

    public void sellComputer(int number) {
        Stock stock = new Stock();
        Purchase purchase = new Purchase();
        if (stock.getStockNumber() < number) {
            purchase.byeComputer(number);
        }
        log.info("销售电脑{}台", number);
        stock.deCrease(number);
    }

    public int getSaleStatus() {
        int randomInt = RandomUtil.randomInt(1, 80);
        log.info("销售情况是:{}", randomInt);
        return randomInt;
    }

    public void offSale() {
        Stock stock = new Stock();
        log.info("折扣销售电脑{}台", stock.getStockNumber());


    }
}
